﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.ServiceModel;
using ContractLibrary;

namespace ConsoleApplication4
{
    class Program
    {
        
        static void Main(string[] args)
        {
            Console.WriteLine("Client starting...");

            IContractServer server;
            EndpointAddress serverAddress = new EndpointAddress("net.tcp://pc-florian:9080/DataService");
            CallbackClient callback = new CallbackClient();
            DuplexChannelFactory<IContractServer> cf = new DuplexChannelFactory<IContractServer>(callback, new NetTcpBinding(SecurityMode.None), serverAddress);
            server = cf.CreateChannel();

            Console.WriteLine("Connexion OK, call method");
            server.Connect();
            string message;
            while (true)
            {
                Console.WriteLine("Tappez votre message :");
                message = Console.ReadLine();
                server.SendMessage(message);
            }
            
            Console.ReadLine();
        }
    }
}
